﻿<Window x:Class="Graphics.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <TabControl>
            <TabItem Header="Ex1 Rectangles">
                <Grid>
                    <Grid.Resources>
                        <Style TargetType="Rectangle">
                            <Setter Property="RadiusX" Value="15"/>
                            <Setter Property="RadiusY" Value="15"/>
                        </Style>
                    </Grid.Resources>
                    <Rectangle Fill="Red" Width="150" Height="20">
                    </Rectangle>
                    <Rectangle Fill="Blue" Width="150" Height="20">
                        <Rectangle.RenderTransform>
                            <RotateTransform CenterX="0" CenterY="0" Angle="45"/>
                        </Rectangle.RenderTransform>
                    </Rectangle>
                    <Rectangle Fill="Yellow" Width="150" Height="20">
                        <Rectangle.RenderTransform>
                            <RotateTransform CenterX="0" CenterY="0" Angle="90"/>
                        </Rectangle.RenderTransform>
                    </Rectangle>
                    <Rectangle Fill="Green" Width="150" Height="20">
                        <Rectangle.RenderTransform>
                            <RotateTransform CenterX="0" CenterY="0" Angle="135"/>
                        </Rectangle.RenderTransform>
                    </Rectangle>
                    <Rectangle Fill="Orange" Width="150" Height="20">
                        <Rectangle.RenderTransform>
                            <RotateTransform CenterX="0" CenterY="0" Angle="180"/>
                        </Rectangle.RenderTransform>
                    </Rectangle>
                    <Rectangle Fill="Aqua" Width="150" Height="20">
                        <Rectangle.RenderTransform>
                            <RotateTransform CenterX="0" CenterY="0" Angle="225"/>
                        </Rectangle.RenderTransform>
                    </Rectangle>
                    <Rectangle Fill="Purple" Width="150" Height="20">
                        <Rectangle.RenderTransform>
                            <RotateTransform CenterX="0" CenterY="0" Angle="270"/>
                        </Rectangle.RenderTransform>
                    </Rectangle>
                    <Rectangle Fill="Pink" Width="150" Height="20" >
                        <Rectangle.RenderTransform>
                            <RotateTransform CenterX="0" CenterY="0" Angle="-45"/>
                        </Rectangle.RenderTransform>
                    </Rectangle>
                </Grid>
            </TabItem>
            <TabItem Header="Ex2 Stars">
                <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                    <StackPanel>
                        <Polygon Points="5,0 7,10 0,3 10,3 3,10" Fill="Yellow" Height="300"
                         Stroke="Black" StrokeThickness="3" Stretch="Uniform">
                        </Polygon>
                        <Polygon Points="5,0 7,10 0,3 10,3 3,10" Fill="Yellow" Height="300"
                         Stroke="Black" StrokeThickness="3" Stretch="Uniform" FillRule="Nonzero">

                        </Polygon>
                    </StackPanel>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="Ex5 Flags">
                <Grid>
                    <StackPanel x:Name="gmFlag" Opacity="0">
                        <Rectangle  Height="80" Stroke="Black" Fill="Yellow" />
                        <Rectangle  Height="80" Stroke="Black" Fill="Red" />
                        <Rectangle  Height="80" Stroke="Black" Fill="Black" />
                    </StackPanel>
                    <StackPanel x:Name="bgFlag" Opacity="0">
                        <Rectangle  Height="80" Stroke="Black" Fill="White"/>
                        <Rectangle  Height="80" Stroke="Black" Fill="Green" />
                        <Rectangle  Height="80" Stroke="Black" Fill="Red" />
                    </StackPanel>
                    <StackPanel x:Name="rsFlag" Opacity="0">
                        <Rectangle  Height="80" Stroke="Black" Fill="White" />
                        <Rectangle  Height="80" Stroke="Black" Fill="Blue" />
                        <Rectangle  Height="80" Stroke="Black" Fill="Red" />
                    </StackPanel>
                    <Grid.Triggers>
                        <EventTrigger RoutedEvent="Grid.Loaded">
                            <BeginStoryboard>
                                <Storyboard RepeatBehavior="Forever">
                                    <DoubleAnimation Storyboard.TargetName="gmFlag" 
                                                     Storyboard.TargetProperty="Opacity"
                                                     From="1" To="0"
                                                     Duration="0:0:2"                                                     
                                                     />
                                    <DoubleAnimation Storyboard.TargetName="bgFlag" 
                                                     Storyboard.TargetProperty="Opacity"
                                                     From="0" To="1"
                                                     Duration="0:0:2" AutoReverse="True"
                                                     />
                                    <DoubleAnimation Storyboard.TargetName="rsFlag" 
                                                     Storyboard.TargetProperty="Opacity"
                                                     From="0" To="1"
                                                     BeginTime="0:0:2" AutoReverse="True"
                                                     Duration="0:0:2"
                                                     />
                                    <DoubleAnimation Storyboard.TargetName="gmFlag" 
                                                     Storyboard.TargetProperty="Opacity"
                                                     From="0" To="1"
                                                     BeginTime="0:0:4"
                                                     Duration="0:0:2"                                                     
                                                     />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Grid.Triggers>
                </Grid>                
            </TabItem>
            <TabItem Header="Ex6 Gradient">
                <Grid>
                    <Grid.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                            <GradientStop Offset="0" Color="White"/>
                            <GradientStop Offset="0.2" Color="Yellow"/>
                            <GradientStop Offset="0.4" Color="Green"/>
                            <GradientStop Offset="0.6" Color="Orange"/>
                            <GradientStop Offset="0.8" Color="Red"/>
                            <GradientStop Offset="1" Color="Purple"/>
                        </LinearGradientBrush>
                    </Grid.Background>
                </Grid>
            </TabItem>
            <TabItem Header="Ex7Transorm">
                <Grid>
                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="40">
                        <TextBlock.LayoutTransform>
                            <TransformGroup>
                                <RotateTransform Angle="45"/>
                            </TransformGroup>
                        </TextBlock.LayoutTransform>
                        Hello,
                    </TextBlock>
                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20">
                        <TextBlock.RenderTransform>
                            <TransformGroup>
                                <RotateTransform Angle="-45"/>
                                <TranslateTransform X="80" Y="10"/>
                            </TransformGroup>
                        </TextBlock.RenderTransform>
                        Doncho
                    </TextBlock>
                </Grid>
            </TabItem>
            <TabItem Header="Ex8">
                <Canvas>
                    <Rectangle Width="100" Height="20" Fill="Blue" x:Name="recBlie">
                        <Rectangle.LayoutTransform>
                            <RotateTransform Angle="0" CenterX="0.5" CenterY="0.5"/>
                        </Rectangle.LayoutTransform>
                        <Rectangle.RenderTransform>
                            <RotateTransform Angle="0" CenterX="50" CenterY="10"/>
                        </Rectangle.RenderTransform>
                        <Rectangle.Triggers>
                            <EventTrigger RoutedEvent="Rectangle.Loaded">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="recBlie" 
                                                         Storyboard.TargetProperty="(Canvas.Left)" 
                                                         From="0"
                                                         To="425"
                                                         AutoReverse="True" RepeatBehavior="Forever"/>
                                        <DoubleAnimation Storyboard.TargetName="recBlie" 
                                                         Storyboard.TargetProperty="(RenderTransform).(RotateTransform.Angle)" 
                                                         From="360"
                                                         To="0" BeginTime="0:0:0" Duration="0:0:0.2" RepeatBehavior="Forever"
                                                         />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Rectangle.Triggers>
                    </Rectangle>
                </Canvas>
            </TabItem>
            <TabItem Header="Ex9">
                <Canvas Background="Black">
                    <Ellipse Canvas.Left="130" Canvas.Top="160" Fill="Orange" Width="20" Height="20">
                        <Ellipse.BitmapEffect>
                            <OuterGlowBitmapEffect GlowSize="120" GlowColor="Orange"/>                                
                        </Ellipse.BitmapEffect>
                    </Ellipse>
                </Canvas>
            </TabItem>
        </TabControl>
    </Grid>
</Window>
